package com.xiebiao.springboot3;

import com.xiebiao.module.EnableMyModule;
import com.xiebiao.module.MyModuleService;
import com.xiebiao.springboot3.entity.UserEntity;
import com.xiebiao.springboot3.service.HelloService;
import com.xiebiao.springboot3.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@SpringBootApplication
@EnableMyModule(enabled = true)
public class MyApplication {
    @Resource
    private HelloService helloService;
    @Resource
    private MyModuleService myModuleService;
    @Resource
    private UserService userService;

    @GetMapping("/")
    String home() {
        return myModuleService.sayHello();
    }

    @GetMapping("/users")
    List<UserEntity> users() {
        List<UserEntity> data = userService.getAll();
        return data;
    }

    public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }
}
